#include <iostream>

using namespace std;
long long cnt = 0;

void hanoi(int n, char a, char b, char c)
{
	if (1 == n) {
		cnt++;
		cout << "move the dist from " << a << " to " << c << endl;
	}
	else {
		hanoi(n - 1, a, c, b);
		cnt++;
		cout << "move the dist from " << a << " to " << c << endl;
		hanoi(n - 1, b, a, c);
	}
}

int main(int argc, char const *argv[])
{
	int n;
	cout << "input the number of disc: ";
	cin >> n;
	hanoi(n, 'A', 'B', 'C');
	cout << cnt << endl;
	return 0;
}